let tools = (() => {
  //将输入框的内容转化为数字
  function digitalize(str) {
    return parseInt(str) || 0;
  }

  function getTarget(ev) {
    const e = ev || window.event,
      tar = e.target || e.srcElement;
    return tar;
  }

  return {
    digitalize,

    getTarget,
  };
})();

let compute = (() => {
  function plus(fVal, sVal) {
    return fVal + sVal;
  }
  function minus(fVal, sVal) {
    return fVal - sVal;
  }
  function mul(fVal, sVal) {
    return fVal * sVal;
  }
  function div(fVal, sVal) {
    return (fVal / sVal) % 1 === 0 ? fVal / sVal : (fVal / sVal).toFixed(2);
  }
  return {
    plus,
    minus,
    mul,
    div,
  };
})();
export { tools, compute };
